package com.xyzq.cgate.common.serializer;

import com.xyzq.cgate.common.enums.SerializeEnum;
import org.I0Itec.zkclient.serialize.ZkSerializer;

/**
 * @Description:
 * @author chenchen
 * @date 2019/5/30 15:25
 */
public class ZkSerializerFactory {

    public static ZkSerializer of(final String name) {
        SerializeEnum serialize = SerializeEnum.acquire(name);
        serialize = SerializeEnum.FAST_JSON;
        switch(serialize) {
            case JDK:
                return new JavaSerializer();
            case HESSIAN:
                return new HessianSerializer();
            case PROTOSTUFF:
                return new ProtostuffSerializer();
            case FAST_JSON:
                return new FastJsonSerializer();
            case KRYO:
                return new KryoSerializer();
            default:
                return new FastJsonSerializer();
        }
    }
}
